package com.xxx.servlet;

import javax.servlet.ServletContextEvent;
import javax.servlet.ServletContextListener;

/**
 * 随着Tomcat的启动执行的监听类
 */
public class TestListener implements ServletContextListener {

    /* (non-Javadoc)
     * @see javax.servlet.ServletContextListener#contextDestroyed(javax.servlet.ServletContextEvent)
     */
    @Override
    public void contextDestroyed(ServletContextEvent sce) {
    }

    /* (non-Javadoc)
     * @see javax.servlet.ServletContextListener#contextInitialized(javax.servlet.ServletContextEvent)
     */
    @Override
    public void contextInitialized(ServletContextEvent sce) {

        //        Thread thread = new Thread(new Runnable() {
        //            @Override
        //            public void run() {
        //                while (true) {
        //                    try {
        //                        Thread.sleep(3000);
        //                    } catch (InterruptedException e) {
        //                        e.printStackTrace();
        //                    }
        //                    System.out.println("刘佳兴大猩猩   " + new SimpleDateFormat("HH:mm:ss").format(new Date()));
        //                }
        //            }
        //        });
        //        thread.start();

    }

}
